﻿using System;
using System.Collections.Generic;

using Rarous.TexyNet;
using Rarous.TexyNet.Configuration;
using Rarous.TexyNet.Modules;

using Xunit;

namespace Rarous.TexyNet.Test {

  /// <summary>
  /// This is a test class for ImageModuleTest and is intended
  /// to contain all ImageModuleTest Unit Tests
  /// </summary>
  public class ImageModuleTest {

    /// <summary>
    /// A test for RootTest
    /// </summary>
    [Fact]
    public void ImageModule_Root_PropertyBehavior() {
      ImageModule target = new ImageModule();
      string expected = "/img/";
      target.Root = expected;

      Assert.Equal(expected, target.Root);
    }

    /// <summary>
    /// A test for RightClassTest
    /// </summary>
    [Fact]
    public void ImageModule_RightClass_PropertyBehavior() {
      ImageModule target = new ImageModule();
      string expected = "img-right";
      target.RightClass = expected;

      Assert.Equal(expected, target.RightClass);
    }

    /// <summary>
    /// A test for ReferencesTest
    /// </summary>
    [Fact]
    public void ImageModule_References_CollectionBehavior() {
      ImageModule target = new ImageModule();

      Assert.NotNull(target.References);
      Assert.Equal(0, target.References.Count);

      target.References.Add(new ImageReference("texy", "http://www.texy.info/logo.gif", "Texy!"));

      Assert.Equal(1, target.References.Count);
    }

    /// <summary>
    /// A test for LinkedRootTest
    /// </summary>
    [Fact]
    public void ImageModule_LinkedRoot_PropertyBehavior() {
      ImageModule target = new ImageModule();
      string expected = "/img/";
      target.LinkedRoot = expected;

      Assert.Equal(expected, target.LinkedRoot);
    }

    /// <summary>
    /// A test for LeftClassTest
    /// </summary>
    [Fact]
    public void ImageModule_LeftClass_PropertyBehavior() {
      ImageModule target = new ImageModule();
      string expected = "img-left";
      target.LeftClass = expected;

      Assert.Equal(expected, target.LeftClass);
    }

    /// <summary>
    /// A test for DefaultAltTest
    /// </summary>
    [Fact]
    public void ImageModule_DefaultAl_PropertyBehavior() {
      ImageModule target = new ImageModule();
      string expected = "image";
      target.DefaultAlt = expected;

      Assert.Equal(expected, target.DefaultAlt);
    }

    /// <summary>
    /// A test for ImageModuleConstructorTest1
    /// </summary>
    [Fact]
    public void ImageModule_Constructor_NullConfigElement() {
      ImageModule target = new ImageModule(null);

      Assert.Equal(String.Empty, target.Root);
      Assert.Equal(String.Empty, target.LinkedRoot);
      Assert.Equal(String.Empty, target.DefaultAlt);
      Assert.Equal("right", target.RightClass);
      Assert.Equal("left", target.LeftClass);
      Assert.NotNull(target.References);
    }

    /// <summary>
    /// A test for ImageModuleConstructorTest
    /// </summary>
    [Fact]
    public void ImageModule_Constructor_Default() {
      ImageModule target = new ImageModule();

      Assert.Equal(String.Empty, target.Root);
      Assert.Equal(String.Empty, target.LinkedRoot);
      Assert.Equal(String.Empty, target.DefaultAlt);
      Assert.Equal("right", target.RightClass);
      Assert.Equal("left", target.LeftClass);
      Assert.NotNull(target.References);
    }
  }
}
